<#include "/layout/header.ftl" />
<#import "/include/ui.ftl" as blue />

<script>

function search_click()
{
	var obj = $.getObject("#div_search");	
	$("#div_grid").simpleLoad("/cms/pan/share_list", obj, 0);
	
}

function edit_click(id, code, name, password)
{
	var obj = {id: id, name: name, code: code, password: password};
	$("#div_share_form").setObject(obj);
	$("#div_share_name").modal("open");
}

function share_save_click()
{
	$.simpleValid("#div_share_form", function(obj)
	{
		$.simpleAjax("/cms/pan/share_save", obj, function(o)
		{
			$.successAlert("分享成功", "save_success()", 2000);
		});
	});
}
function save_success()
{
	window.location = "${path}/cms/pan/share_list";
}

function delete_click(id)
{
	var obj = {ids: id};
	$.simpleConfirm("确定删除？", function(ops)
	{
		$.simpleAjax("/cms/pan/share_delete", obj, function(o)
		{
			$.successAlert("删除成功");
			$("#tr_" + id).remove();
		});
	});
}
</script>

<div class="am-g am-cf am-margin-top am-margin-bottom">
	<div class="am-u-sm-3 am-padding-right-0">
		<div class="am-btn-group">
		</div>
	</div>
	<div class="am-u-sm-9 am-form-inline" id="div_search">

		<div class="am-form-group">
			<input type="text" name="name" class="am-form-field" placeholder="输入分享名称" />
		</div>

		<a href="javascript:void(0)" onclick="search_click()" class="am-btn am-btn-primary am-radius">搜索</a>
	</div>
</div>

<div class="am-g" id="div_grid">
	<#include "/cms/pan/share_list_grid.ftl" />
</div>

<div class="am-modal am-modal-no-btn" tabindex="-1" id="div_share_name">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">
			分享设置
			<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		</div>
		<div class="am-modal-bd" id="div_share_form">
			<input type="hidden" name="id"/>
			<div class="am-form am-form-horizontal am-cf am-margin">
				<div class="am-form-group">
					<div class="am-u-sm-12">
						<input type="text" name="name" placeholder="输入分享名称" class="am-form-field am-radius"  maxlength="200"  required/>
					</div>
				</div>
				<div class="am-form-group">
					<div class="am-u-sm-6">
						<input type="text" name="code"  class="am-form-field am-radius" readonly />
					</div>
					<div class="am-u-sm-6">
						<input type="text" name="password" placeholder="输入分享密码" class="am-form-field am-radius"  maxlength="10" />
					</div>
				</div>
			</div>
			<a href="javascript:void(0)" onclick="share_save_click()" class="am-btn am-btn-primary am-radius am-margin-top">保存</a>
		</div>
	</div>
</div>

<#include "/layout/footer.ftl" />